package service

import (
	"context"
	"fmt"
	"github.com/tx7do/kratos-transport/broker"
	"kratos_kafka_new/internal/utils/mq_kafka"
)

// 从kafka中接收数据并处理
func (s *GreeterService) HandleReceiveArticleData(ctx context.Context, topic string, event broker.Event, headers broker.Headers, msg *mq_kafka.ArticleData) error {

	fmt.Printf("HandleReceiveArticleData111, Topic %s,  Msg:%v \n", topic, msg)

	// Notice 这里面可以做一些业务逻辑～
	return s.uc.AutoHandleArticleData(ctx, event, msg)
}

func (s *GreeterService) HandleReceiveArticleData2(ctx context.Context, topic string, event broker.Event, headers broker.Headers, msg *mq_kafka.ArticleData) error {

	fmt.Printf("HandleReceiveArticleData222, Topic %s,  Msg:%v \n", topic, msg)

	return s.uc.AutoHandleArticleData2(ctx, event, msg)
}
